﻿@using static AutoMail.Enums.ComponentEnums
@model IEnumerable<AutoMail.Models.EmailJob>

@{
    ViewData["Title"] = "Home";
}

<h1>Staff Auto Mail Sending List</h1>

<p>
    <a asp-action="Create">Create a new staff mail sending item</a>
</p>
<table class="table">
    <thead>
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.StaffName)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Sex)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.BirthDay)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Email)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.EmailBody)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.ComeToCompanyDate)
            </th>
            <th></th>
        </tr>
    </thead>
    <tbody>
@foreach (var item in Model) {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.StaffName)
            </td>
            <td>
                @(Enum.GetName(typeof(ESex), item.Sex))
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.BirthDay)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Email)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.EmailBody)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ComeToCompanyDate)
            </td>
            <td>
                <a asp-action="Edit" asp-route-id="@item.Id">Edit</a> |
                <a asp-action="Details" asp-route-id="@item.Id">Details</a> |
                <a asp-action="Delete" asp-route-id="@item.Id">Delete</a>
            </td>
        </tr>
}
    </tbody>
</table>
